﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Peter.Common.Controls">

   <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="pack://application:,,,/Peter.Common;component/Themes/Common.xaml" />
   </ResourceDictionary.MergedDictionaries>
   
   <Style TargetType="{x:Type controls:Toast}">
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type controls:Toast}">
               <Border Height="0"
                       BorderThickness="1"
                       x:Name="PART_MainBorder"
                       Background="{DynamicResource ToastInfoBackgroundBrush}"
                       BorderBrush="{DynamicResource ToastInfoBorderBrush}">
                  <Grid VerticalAlignment="Center"
                        Margin="10,0">
                     <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                     </Grid.ColumnDefinitions>
                     <controls:StatusIcon Status="{TemplateBinding Status}"
                                          Margin="0,0,5,0"
                                          Grid.Column="0"
                                          x:Name="PART_Status" />
                     <ContentPresenter Content="{TemplateBinding Content}"
                                       Grid.Column="1" />
                     <Button Grid.Column="2"
                             Style="{StaticResource CloseButtonStyle}"
                             x:Name="PART_CloseButton" />
                  </Grid>
               </Border>
               <ControlTemplate.Triggers>
                  <Trigger Property="Status"
                           Value="Bad">
                     <Setter TargetName="PART_Status"
                             Property="Foreground"
                             Value="{DynamicResource ToastErrorForegroundBrush}" />
                     <Setter TargetName="PART_MainBorder"
                             Property="BorderBrush"
                             Value="{DynamicResource ToastErrorBorderBrush}" />
                     <Setter TargetName="PART_MainBorder"
                             Property="Background"
                             Value="{DynamicResource ToastErrorBackgroundBrush}" />
                     <Setter Property="Foreground"
                             Value="{DynamicResource ToastErrorForegroundBrush}" />
                  </Trigger>
                  <Trigger Property="Status"
                           Value="Warn">
                     <Setter TargetName="PART_Status"
                             Property="Foreground"
                             Value="{DynamicResource ToastWarningForegroundBrush}" />
                     <Setter TargetName="PART_MainBorder"
                             Property="BorderBrush"
                             Value="{DynamicResource ToastWarningBorderBrush}" />
                     <Setter TargetName="PART_MainBorder"
                             Property="Background"
                             Value="{DynamicResource ToastWarningBackgroundBrush}" />
                     <Setter Property="Foreground"
                             Value="{DynamicResource ToastWarningForegroundBrush}" />
                  </Trigger>
                  <Trigger Property="Status"
                           Value="Good">
                     <Setter TargetName="PART_Status"
                             Property="Foreground"
                             Value="{DynamicResource ToastAllGoodForegroundBrush}" />
                     <Setter TargetName="PART_MainBorder"
                             Property="BorderBrush"
                             Value="{DynamicResource ToastAllGoodBorderBrush}" />
                     <Setter TargetName="PART_MainBorder"
                             Property="Background"
                             Value="{DynamicResource ToastAllGoodBackgroundBrush}" />
                     <Setter Property="Foreground"
                             Value="{DynamicResource ToastAllGoodForegroundBrush}" />
                  </Trigger>
                  <Trigger Property="Status"
                           Value="None">
                     <Setter TargetName="PART_Status"
                             Property="Visibility"
                             Value="Collapsed" />
                     <Setter TargetName="PART_MainBorder"
                             Property="BorderBrush"
                             Value="{DynamicResource MainBorderBrush}" />
                     <Setter TargetName="PART_MainBorder"
                             Property="Background"
                             Value="{DynamicResource SecondaryBrush}" />
                  </Trigger>
                  <Trigger Property="ShowCloseButton"
                           Value="False">
                     <Setter TargetName="PART_CloseButton"
                             Property="Visibility"
                             Value="Collapsed" />
                  </Trigger>
                  <EventTrigger RoutedEvent="Show">
                     <BeginStoryboard>
                        <Storyboard>
                           <DoubleAnimation BeginTime="00:00:00.000"
                                            Duration="00:00:00.200"
                                            From="0"
                                            To="45"
                                            Storyboard.TargetProperty="Height"
                                            Storyboard.TargetName="PART_MainBorder" />
                        </Storyboard>
                     </BeginStoryboard>
                  </EventTrigger>
                  <EventTrigger RoutedEvent="Hide">
                     <BeginStoryboard>
                        <Storyboard>
                           <DoubleAnimation BeginTime="00:00:00.000"
                                            Duration="00:00:00.100"
                                            From="45"
                                            To="0"
                                            Storyboard.TargetProperty="Height"
                                            Storyboard.TargetName="PART_MainBorder" />
                        </Storyboard>
                     </BeginStoryboard>
                  </EventTrigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

</ResourceDictionary>